home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / Developer University / DUProjects / GraphicsBfr / Sources / Part.cpp < prev    next >
Encoding:
Text File  |  1996-03-29  |  2.8 KB  |  111 lines  |  [TEXT/CWIE]

  1. //    Release Version:    $ ODF 1 $
  2. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  3.  
  4. //================================================================================
  5. #ifndef PART_H
  6. #include "Part.h"
  7. #endif
  8.  
  9. #ifndef FRAME_H
  10. #include "Frame.h"
  11. #endif
  12.  
  13. #ifndef DEFINES_K
  14. #include "Defines.k"
  15. #endif
  16.  
  17. #ifndef BINDING_K
  18. #include "Binding.k"
  19. #endif
  20.  
  21. // ----- Framework Includes -----
  22. #ifndef FWUTIL_H
  23. #include "FWUtil.h"
  24. #endif
  25.  
  26. #ifndef FWABOUT_H
  27. #include "FWAbout.h"        //::FW_About()
  28. #endif
  29.  
  30. #include "SLMixOS.h"    // FW_GetMainScreenBounds
  31.  
  32. //==============================================================================
  33. #ifdef FW_BUILD_MAC
  34. #pragma segment GraphicsBfr
  35. #endif
  36.  
  37. FW_DEFINE_AUTO(CGraphicsBfrPart)
  38. //==============================================================================
  39. CGraphicsBfrPart::CGraphicsBfrPart(ODPart* odPart)
  40.   :    FW_CPart(odPart, FW_gInstance, kPartInfoID),
  41.       fPresentation(NULL)
  42. {
  43. }
  44.  
  45. //--------------------------------------------------------------------------------
  46. CGraphicsBfrPart::~CGraphicsBfrPart()
  47. {
  48. }
  49.  
  50. //--------------------------------------------------------------------------------
  51. void 
  52. CGraphicsBfrPart::Initialize(Environment* ev)    // Override
  53. {
  54.     FW_CPart::Initialize(ev);
  55.     FW_CSelection* selection = NULL;
  56.     const ODType kMainPresentation = "Apple:Presentation:GraphicsBfr";
  57.     fPresentation = this->RegisterPresentation(ev, kMainPresentation, true, selection);
  58. }
  59.  
  60. //--------------------------------------------------------------------------------
  61. FW_CFrame* 
  62. CGraphicsBfrPart::NewFrame(Environment* ev, ODFrame* odFrame,
  63.                         FW_CPresentation* presentation, FW_Boolean fromStorage)    // Override
  64. {
  65.     FW_UNUSED(presentation);
  66.     FW_UNUSED(fromStorage);
  67.     return FW_NEW(CGraphicsBfrFrame, (ev, odFrame, presentation, this));
  68. }
  69.  
  70. //----------------------------------------------------------------------------------------
  71. FW_CWindow* 
  72. CGraphicsBfrPart::NewDocumentWindow(Environment* ev)
  73. {    
  74.     FW_CRect screenBounds;
  75.     ::FW_GetMainScreenBounds(screenBounds);
  76.     screenBounds.Inset(FW_IntToFixed(3), FW_IntToFixed(3));
  77.     
  78.     return new FW_CWindow(ev,
  79.                         this,
  80.                          FW_CPart::gViewAsFrameToken,
  81.                         fPresentation,
  82.                         FW_CPoint(FW_IntToFixed(300), FW_IntToFixed(300)),
  83.                         screenBounds.TopLeft(),
  84.                         FW_kDocumentWindow);
  85. }
  86.  
  87. //--------------------------------------------------------------------------------
  88. FW_CContent* 
  89. CGraphicsBfrPart::NewPartContent(Environment* ev)
  90. {
  91.     return NULL;
  92. }
  93.  
  94. //--------------------------------------------------------------------------------
  95. FW_Boolean 
  96. CGraphicsBfrPart::DoMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent)    // Override
  97. {
  98.     FW_Boolean menuHandled = true;
  99.     switch (theMenuEvent.GetCommandID(ev))
  100.     {
  101.         case kODCommandAbout:
  102.             ::FW_About(ev, this, kAbout);
  103.             break;
  104.  
  105.         default:
  106.             menuHandled = false;
  107.     }
  108.     return menuHandled;
  109. }
  110.  
  111.